﻿
using DG.Tweening;
using StarForce;
using UnityEngine.UI;

namespace ETHotfix
{
    class TestHotUI : HotfixUGuiForm
    {
        public const string PrefabName = "TestHotUI";
        private Text m_Text;

        public override void OnInit(StarForce.HotfixUGuiForm uiFormLogic, object userdata)
        {
            base.OnInit(uiFormLogic, userdata);
            Log.Info("TestHotUI OnInit");
            m_Text = uiFormLogic.variables.Get<Text>("text3");
            // m_Text = uiFormLogic.transform.Find("Text3").GetComponent<Text>();
        }

        public override void OnOpen(object userdata)
        {
            base.OnOpen(userdata);
            Log.Info("TestHotUI OnOpen");
            m_Text.DOText("DoTween,3秒后跳转登录",3).SetEase(Ease.Linear).Play().onComplete = async () =>
            {
                await GFGame.UI.OpenUIFormAsync(LoginUI.PrefabName.GetUIPath(), "Low",  true);
                UIFormLogic.Close();
            };
        }

        public override void OnClose(object userdata)
        {
            base.OnClose(userdata);
            Log.Info("TestHotUI OnClose");
        }

        public override void OnPause()
        {
            base.OnPause();
            Log.Info("TestHotUI OnPause");
        }

        public override void OnResume(object userdata)
        {
            base.OnResume(userdata);
            Log.Info("TestHotUI OnResume");
        }

        public override void OnCover(object userdata)
        {
            base.OnCover(userdata);
            Log.Info("TestHotUI OnCover");
        }

        public override void OnReveal()
        {
            base.OnReveal();
            Log.Info("TestHotUI OnReveal");
        }

        public override void OnRefocus(object userData)
        {
            base.OnRefocus(userData);
            Log.Info("TestHotUI OnRefocus");
        }

        public override void OnUpdate(float elapseSeconds, float realElapseSeconds)
        {
            base.OnUpdate(elapseSeconds, realElapseSeconds);
            Log.Info("TestHotUI OnUpdate");
        }

        public override void OnDepthChanged(int uiGroupDepth, int depthInUIGroup)
        {
            base.OnDepthChanged(uiGroupDepth, depthInUIGroup);
            Log.Info("TestHotUI OnDepthChanged");
        }
    }
}
